home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / microcrn / issue_46.arc / ISR.ARC / CPU.H < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-11  |  2.3 KB  |  82 lines

  1. /*    CPU.h -  #defs etc. from the TPC header files. CPU related stuff...
  2.  
  3.         Supports ISR article in Micro Cornucopia Magazine Issue #46
  4. */
  5.  
  6. /*    8086 cpu opcodes
  7. */
  8.  
  9. #define OP_JMPF     0xea        /* far jump instruction            */
  10. #define OP_CALLF 0x9a        /* far call instruction            */
  11. #define OP_RETF     0xcb        /* far return instruction        */
  12. #define OP_INT   0xcd        /* software interrupt instr.        */
  13. #define OP_IRET  0xcf           /* return from interrupt                */
  14.  
  15. /*    CPU flag register bit masks
  16. */
  17.  
  18. #define FLG_RESf    0x8000    /* unused                */
  19. #define FLG_RESe    0x4000    /*                    */
  20. #define FLG_RESd    0x2000    /*                    */
  21. #define FLG_RESc    0x1000    /*                    */
  22. #define FLG_OF        0x0800    /* overflow                */
  23. #define FLG_DIR        0x0400    /* Direction - 0=Auto Inc, 1=Auto Dec    */
  24. #define FLG_INTE    0x0200    /* Interrupt Enable            */
  25. #define FLG_TRAP    0x0100    /* Trap Flag - 1=single step        */
  26. #define FLG_SIGN    0x0080    /* Sign Flag - 1=result NEGATIVE    */
  27. #define FLG_ZERO    0x0040    /* Zero Flag - 1=result ZERO        */
  28. #define FLG_RES5    0x0020    /*                    */
  29. #define FLG_AUXC    0x0010    /* Auxiliary carry flag            */
  30. #define FLG_RES3    0x0008    /*                    */
  31. #define FLG_PE        0x0004    /* Parity Even - 1=has even #of 1 bits    */
  32. #define FLG_RES1    0x0002    /*                    */
  33. #define FLG_CARRY    0x0001    /* Carry Flag                */
  34.  
  35. #asm
  36. FLG_OF        equ    0800h
  37. FLG_DIR        equ    0400h
  38. FLG_INTE    equ    0200h
  39. FLG_TRAP    equ    0100h
  40. FLG_SIGN    equ    0080h
  41. FLG_ZERO    equ    0040h
  42. FLG_AUXC    equ    0010h
  43. FLG_PE        equ    0004h
  44. FLG_CARRY    equ    0001h
  45. #endasm
  46.  
  47.  
  48. /*    Structure of the PSW register...
  49.  
  50. WARNING: 
  51.  
  52. "There are a number of caveats that apply to (bit) fields.  Perhaps 
  53. most significant, fields are assigned left to right on some machines 
  54. and right to left on others, reflecting the nature of different 
  55. hardware. This means that although fields are quite useful for 
  56. maintaining internally-defined data structures, the question of which 
  57. end comes first has to be carefully considered..."
  58.                                         - K&R, page 138.
  59. */
  60.  
  61. typedef struct __FLAGS {
  62.    unsigned carry : 1;
  63.    unsigned res1 : 1;
  64.    unsigned pe : 1;
  65.    unsigned res3 : 1;
  66.    unsigned auxc : 1;
  67.    unsigned res5 : 1;
  68.    unsigned zero : 1;
  69.    unsigned sign : 1;
  70.    unsigned trap : 1;
  71.    unsigned inte : 1;
  72.    unsigned dir : 1;
  73.    unsigned of : 1;
  74.    unsigned resc : 1;
  75.    unsigned resd : 1;
  76.    unsigned rese : 1;
  77.    unsigned resf : 1;
  78. } __flags;
  79.  
  80.  
  81.  
  82.